Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

TL;DR

Added a new GridError schema and improved error handling in the OpenAPI specification.

What changed?

  • Created a new GridError schema to standardize error responses
  • Added additionalProperties: true to all error schema details objects to allow for flexible error details
  • Refactored BulkCustomerImportErrorEntry to extend from GridError instead of using a nested error structure
  • Updated webhook response schemas to reference GridError instead of Error

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

This PR introduces a new GridError schema and standardizes error handling across the API specification by adding additionalProperties: true to error details objects.

Key Changes:

  • Created GridError schema with flexible error details via additionalProperties: true
  • Updated all HTTP error schemas (400, 401, 403, 404, 409, 412, 424, 500, 501) to allow additional properties in details objects
  • Refactored BulkCustomerImportErrorEntry to extend GridError using composition instead of nested error structure
  • Updated webhook response schemas (IncomingPaymentWebhookForbiddenResponse and IncomingPaymentWebhookUnprocessableResponse) to reference GridError

Architecture Improvement:
The change from nested error objects to composition via allOf in BulkCustomerImportErrorEntry improves schema reusability and maintains consistency across error responses. The addition of additionalProperties: true provides flexibility for including custom error metadata while maintaining a consistent error structure.

Minor Issue:
One reference to the old Error schema remains in openapi/paths/customers/customers_{customerId}.yaml for the 410 response. While this doesn't break functionality since Error.yaml still exists, updating it to GridError.yaml would ensure complete consistency across all error responses.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - changes are well-structured and backward compatible
  • The changes are straightforward schema updates that improve error handling flexibility. The new GridError schema and additionalProperties: true additions are backward compatible since they only make the schema more permissive. The refactoring of BulkCustomerImportErrorEntry improves maintainability. One minor inconsistency exists with the 410 error response still using the old Error schema, but this doesn't introduce any breaking changes since both schemas are functionally similar and Error.yaml remains in the codebase.
  • openapi/paths/customers/customers_{customerId}.yaml has one outdated schema reference that should be updated for consistency

Important Files Changed

Filename Overview
openapi/components/schemas/common/GridError.yaml New GridError schema created with additionalProperties: true for flexible error details
openapi/components/schemas/customers/BulkCustomerImportErrorEntry.yaml Refactored to extend GridError using allOf composition instead of nesting error structure
openapi/components/schemas/webhooks/IncomingPaymentWebhookForbiddenResponse.yaml Updated to extend GridError instead of Error schema
openapi/components/schemas/webhooks/IncomingPaymentWebhookUnprocessableResponse.yaml Updated to extend GridError instead of Error schema
openapi.yaml Bundled OpenAPI spec with all error schema changes, but missed updating 410 error reference
mintlify/openapi.yaml Copy of bundled spec for Mintlify, contains same 410 error reference issue

Sequence Diagram

sequenceDiagram
    participant API as Grid API
    participant Client as API Client
    participant Schema as Error Schema
    
    Note over API,Schema: Error Response Flow
    
    Client->>API: Request with potential error
    API->>Schema: Generate error response
    
    alt Using GridError (new)
        Schema->>Schema: Create GridError object
        Schema->>Schema: Add code, message
        Schema->>Schema: Add details (additionalProperties: true)
        Schema->>API: Return GridError
    else Using Error4xx/5xx (updated)
        Schema->>Schema: Create specific Error object
        Schema->>Schema: Add status, code, message
        Schema->>Schema: Add details (additionalProperties: true)
        Schema->>API: Return specific Error
    else Using BulkCustomerImportErrorEntry
        Schema->>Schema: Extend GridError via allOf
        Schema->>Schema: Add correlationId field
        Schema->>API: Return enriched error
    end
    
    API->>Client: Return error response with flexible details
Loading

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from 6432728 to e5749d2 Compare January 27, 2026 01:29
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Incomplete migration: still references Error.yaml instead of GridError.yaml. For consistency with the rest of this PR, this should be updated to use GridError.yaml.

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Incomplete migration: still references `Error.yaml` instead of `GridError.yaml`. For consistency with the rest of this PR, this should be updated to use `GridError.yaml`.

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 68ab09c to 5786fb9 Compare January 27, 2026 05:18
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from e5749d2 to a27f6e6 Compare January 27, 2026 05:19
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Inconsistent error schema reference - should use GridError.yaml instead of Error.yaml to match the PR's goal of standardizing on GridError

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Inconsistent error schema reference - should use `GridError.yaml` instead of `Error.yaml` to match the PR's goal of standardizing on `GridError`

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 5786fb9 to 79467e5 Compare January 27, 2026 05:24
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from a27f6e6 to a1379cd Compare January 27, 2026 05:24
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Update this to reference GridError for consistency with other error responses

            $ref: ../../components/schemas/common/GridError.yaml

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Update this to reference `GridError` for consistency with other error responses

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants